home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / languages / fpl-v115.lha / fpl / docs / fpl.doc next >
Encoding:
Text File  |  1995-02-22  |  52.2 KB  |  1,505 lines

  1. TABLE OF CONTENTS
  2.  
  3. fpl.library/fplAddFunction
  4. fpl.library/fplAddVariable
  5. fpl.library/fplAlloc
  6. fpl.library/fplAllocString
  7. fpl.library/fplAlloca
  8. fpl.library/fplCloseLib
  9. fpl.library/fplConvertString
  10. fpl.library/fplDealloc
  11. fpl.library/fplDealloca
  12. fpl.library/fplDelFunction
  13. fpl.library/fplExecuteFile
  14. fpl.library/fplExecuteScript
  15. fpl.library/fplFree
  16. fpl.library/fplFreeString
  17. fpl.library/fplGetErrorMsg
  18. fpl.library/fplInit
  19. fpl.library/fplLtostr
  20. fpl.library/fplOpenLib
  21. fpl.library/fplReference
  22. fpl.library/fplReset
  23. fpl.library/fplSend
  24. fpl.library/fplStrtol
  25. fpl.library/fplStrtol                                 fpl.library/fplStrtol
  26.  
  27.    NAME
  28.     fplStrtol -- convert a string holding a number to a long integer.
  29.  
  30.    SYNOPSIS
  31.     long fplStrtol( string, base, end);            (V8)
  32.     D0        A0      D0    D1
  33.  
  34.    FUNCTION
  35.     Converts a string representation of a number to a long integer.
  36.     The convertion will use the supplied base or if zero (0) is specified,
  37.     it will scan the string and figure out the base itself. The recognized
  38.     prefixes are the FPL standard; '0' for octal numbers, '0x' for
  39.     hexadecimal and '0b' for binary.
  40.     The 'end' parameter is a supplied pointer to a char pointer in which
  41.     the position of the final parse position will be stored.
  42.  
  43.    RESULT
  44.     The long integer the string was converted to!
  45.  
  46.    INPUTS
  47.     char *string    - Pointer to the string to convert!
  48.     long base    - Base to use when the convertion is performed
  49.     char **end    - Pointer to a char pointer in where to store the
  50.               position of the end of the convertion.
  51.  
  52.    SEE ALSO
  53.     fplLtostr and the strtol() function in FPLuser.guide
  54.  
  55. fpl.library/fplLtostr                               fpl.library/fplLtostr
  56.  
  57.    NAME
  58.     fplLtostr -- convert a long integer to a string.
  59.  
  60.    SYNOPSIS
  61.     char *fplLtostr( key, base, number);            (V8)
  62.     D0               A0   D0    D1
  63.  
  64.    FUNCTION
  65.     Converts the inpute 'number' using the 'base' parameter. The result
  66.     will be returned as a pointer to a stringm or NULL is something
  67.     failed. Each call to this function must have a matching call to the
  68.     fplFreeString() function.
  69.  
  70.    RESULT
  71.     A pointer to a zero terminated string or NULL if the function failed.
  72.     The returned string must be freed with a call to fplFreeString().
  73.  
  74.    INPUTS
  75.     void *key    - Return value from fplInit().
  76.     long base    - Base to use when converting.
  77.     long number    - Number to create a string from.
  78.  
  79.    SEE ALSO
  80.     fplStrtol and the ltostr() function in FPLuser.guide
  81.  
  82. fpl.library/fplConvertString                     fpl.library/fplConvertString
  83.  
  84.    NAME
  85.     fplConvertString -- convert FPL string to binary.
  86.  
  87.    SYNOPSIS
  88.     long fplConvertString( key, convert, buffer );        (V4)
  89.     D0               A0   A1       A2
  90.  
  91.    FUNCTION
  92.     Convert a FPL syntax string to a binary string. *ALL* in FPL allowed
  93.     backslash sequences are supported. The string to convert should be a
  94.     zero terminated string.
  95.  
  96.     The output will be stored in the buffer given as input. FPL also adds
  97.     a terminating zero to the output string.
  98.  
  99.    RESULT
  100.     The number of characters in the output string. The terminating zero
  101.     excluded.
  102.  
  103.    INPUTS
  104.     void *key    - Return value from fplInit().
  105.     vhar *convert    - String to convert to binaries.
  106.     char *buffer    - Pointer to buffer large enough to hold the resulting
  107.               string plus an additional zero terminate byte.
  108.  
  109. fpl.library/fplExecuteScript                     fpl.library/fplExecuteScript
  110.  
  111.    NAME
  112.     fplExecuteScript -- execute an FPL program.
  113.     fplExecuteScriptTags -- execute an FPL program.
  114.  
  115.    SYNOPSIS
  116.     long fplExecuteScript( key, program, lines, tags );
  117.     D0                  A0   A1         D0     A2
  118.  
  119.     For SAS/C users:
  120.     long fplExecuteScriptTags( key, program, lines, ... );
  121.  
  122.    FUNCTION
  123.     This function executes the program (array of char pointers) pointed
  124.     to by the program parameter according to the rules set by the
  125.     call to fplInit(). Each line must end with a zero (0) byte.
  126.     If any error occurs, the function returns proper error code (see
  127.     FPL.h).
  128.  
  129.     If the program is started and is expected only to run once and then to
  130.     be removed from memory, use the FPLTAG_STOREGLOBALS tag to disable any
  131.     global symbol storage.
  132.  
  133.     The tag list pointer is new for V3.
  134.  
  135.    TAGS
  136.     FPLTAG_INTERPRET
  137.       This data is interpreted after all declaring and prototyping has been
  138.       done in the FPL program. NULL will disable. Mainly implemented to
  139.       enable single function invokes within a larger program. The data of
  140.       this tag is to be looked upon as a string argument to an interpret()
  141.       function call. After this interpret() call, the FPL program will
  142.       exit.
  143.         This example calls only the function named foobar (with 2 and 3
  144.         as parameters) within the much larger program:
  145.  
  146.         unsigned long tags={
  147.           FPLTAG_INTERPRET, "foobar(2, 3);", FPLTAG_DONE
  148.         };
  149.         fplExecuteScript(anchor, programarray, 200, tags);
  150.  
  151.       NOTE: This intepreted statement will act *EXACTLY* as if it is
  152.       interpreted by the program right before the actual start of the main
  153.       program. If you call any inside function, it *must* be prototyped
  154.       properly first or else this will fail!
  155.  
  156.       HINT: This enables a beautilful way for us to send arguments to the
  157.       FPL functions. By making the main function including prototyping just
  158.       as any other function. Invoke the following example with the tag
  159.       {FPLTAG_INTERPRET, "main(22, \"Daniel\");"} and you see my point!
  160.         Example:
  161.  
  162.         int main(int, string);
  163.         exit(-1);    /* just to prevent normal starts */
  164.         int main(int age, string name)
  165.         {
  166.            output(name " is " age " years old!\n");
  167.         }
  168.  
  169.  
  170.     FPLTAG_STARTPOINT.
  171.       By setting this pointer you can force FPL to start interpreting at
  172.       another position than from the start of the program. If this start
  173.       position is on any other line than the first, FPLTAG_STARTLINE must
  174.       be set too.
  175.  
  176.     FPLTAG_STARTLINE
  177.       Set this only if you set the FPLTAG_STARTPOINT tag. By only setting
  178.       this tag, you achieve nothing but confusing the interpreter.
  179.  
  180.       NOTE regarding these upper two tags: when changing the interpreting
  181.       start position you must think of that the variable declarations
  182.       and/or function prototyping that may be written in the original
  183.       start of program might get passed.
  184.  
  185.     FPLTAG_USERDATA
  186.       Does the same as when used in fplInit() or fplReset().
  187.  
  188.     FPLTAG_CACHEFILE
  189.       Turn on or off FPL caching of this file. Default is set with the
  190.       'FPLTAG_CACHEALLFILES' in a fplInit() or a previous fplReset()
  191.       call. Its default is FPLCACHE_NONE.
  192.  
  193.       Cashing can be done in three ways:
  194.       FPLCACHE_NONE    - Will never ever cache a file
  195.       FPLCACHE_ALWAYS  - Will cache files that have one or more global
  196.                  symbols
  197.       FPLCACHE_EXPORTS - Will only cache files that have exported symbols.
  198.  
  199.       NOTE: Files that do not declare any global symbols will not be
  200.       cached, no matter what this tag says!
  201.  
  202.     FPLTAG_FILEGLOBALS/FPLTAG_ISCACHED
  203.       Supply this tag a pointer to a `long'. This variable will tell if the
  204.       progam declared any global symbols, which is the same as if it is to
  205.       be cached. The long will contain zero if no global symbols were
  206.       declared or non-zero if a not known number of variables were
  207.       declared.
  208.  
  209.     FPLTAG_PROGNAME
  210.       Name of the FPL program. When using multiple FPL source files it is
  211.       almost required to use this tag. If any error occurs when running
  212.       FPL, the FPLSEND_GETPROGNAME will receive a pointer to the program
  213.       name (or "<unknown program>" if it is never set). fplExecuteFile()
  214.       sets the program name by default to the file name. Programs without
  215.       names can never be cached!
  216.  
  217.     FPLTAG_FILENAMEGET
  218.       Tells FPL that when this file has been flushed, the program can be
  219.       found by using the program name as file name to read from. Set as
  220.       default be fplExecuteFile().
  221.  
  222.     FPLTAG_STRING_RETURN                    (V6)
  223.       Supply a pointer to a char pointer. This enables the started FPL
  224.       programs to return a string to you. The string can be returned from
  225.       the main (highest) level of the FPL program with "return" or from
  226.       any level with "exit". The string will be readable just like any
  227.       regular string from FPL. The FPL_STRLEN macro will give to the
  228.       length of the returned string.
  229.  
  230.       Programs that are executed with this tag set will not be able to
  231.       return any other data than a string! Using the FPLSEND_GETRETURNCODE
  232.       tag in a fplSend() call will not return a valid number!
  233.  
  234.       The string is to be treated exactly as fplAllocString() strings:
  235.       you must fplFreeString() it when you have finished using it. The
  236.       string can even be used with the FPLSEND_DONTCOPY_STRING tag to
  237.       the fplSend() call!
  238.  
  239.     FPLTAG_REREAD_CHANGES                    (V8)
  240.       Suppy a boolean to switch this on/off for this script/file. When
  241.       enabled this file is attempted to be ran and the actual file has
  242.       been changed on disk, all symbols declared in the file will be
  243.       removed and the new version will be loaded and run instead.
  244.  
  245.       * Default for this state is set with the same tag to fplInit().
  246.       * This can be forced on/off with the pragmas 'reread' and 'noreread'
  247.         inside the FPL program.
  248.       * This tag will only be of use for calls to fplExecuteFile().
  249.  
  250.     FPLTAG_FLUSH_NOT_IN_USE                    (V8)
  251.       Suppy a boolean to switch this on/off for this script/file. When
  252.       enabled, and this file isn't in use, the program will be flushed
  253.       from memory and read into memory again when accessed.
  254.  
  255.       * Default for this state is set with the same tag to fplInit().
  256.       * This can be forced with the pragmas 'cache' and 'nocache'
  257.         inside the FPL program. They force the file to remain in memory
  258.         or not.
  259.  
  260.     FPLTAG_KIDNAP_CACHED                    (V9)
  261.       (This is only usful in calls to fplExecuteScript().)
  262.       Suppy a boolean to switch this on/off for this script/file. When
  263.       enabled, FPL will duplicate all programs that should be cashed.
  264.       By default, FPL will simply use the supplied program pointer,
  265.       whether the program is cached or not. By using this tag, the host
  266.       program can do whatever it wants with the memory after an execution,
  267.       if if the program was cached.
  268.  
  269.       * Default for this state is set with the same tag to fplInit().
  270.  
  271.     FPLTAG_DEBUG                        (V9)
  272.       Suppy a boolean to switch this on/off for this script/file. When
  273.       enabled, FPL runs the program/script in 'debug mode'. Debug mode
  274.       enables certain hooks and control stuff that wouldn't be done
  275.       otherwise, and also always an external debugger to supervise the
  276.       execution. "FPLdb" will be available in the future to provide a
  277.       debugger for FPL usage on Amiga. The local status for debug mode
  278.       can be altered and set with the debug() internal FPL function.
  279.  
  280.       * Default for this state is set with the same tag to fplInit().
  281.  
  282.    RESULT
  283.     The error number, or zero (0) if everything was ok.
  284.  
  285.    INPUTS
  286.     void *key        - Return value from fplInit().
  287.     char **program        - The FPL program to execute.
  288.     long lines        - Number of lines in the program.
  289.     unsigned long *tags     - Pointer to a tag list.
  290.  
  291.    SEE ALSO
  292.     fplExecuteFile
  293.  
  294. fpl.library/fplExecuteFile                       fpl.library/fplExecuteFile
  295.  
  296.    NAME
  297.     fplExecuteFile -- execute a file as an FPL program.
  298.     fplExecuteFileTags -- execute a file as an FPL program.
  299.  
  300.    SYNOPSIS
  301.     long fplExecuteFile( key, filename, tags );
  302.     D0               A0      A1        A2
  303.  
  304.     For SAS/C users:
  305.     long fplExecuteFileTags( key, filename, ... );
  306.  
  307.    FUNCTION
  308.     This function executes the file with the name pointed to by the
  309.     filename parameter according to the rules set by the fplInit()
  310.     function call. If any error occurs, the subroutine returns.
  311.     The program is loaded into memory before execution. If the program
  312.     didn't export any functions or if it shouldn't be cached, it will be
  313.     unloaded when the program exits.
  314.  
  315.     fplExecuteFile() will internally read the given file and then call
  316.         fplExecuteScript().
  317.  
  318.    TAGS
  319.     The tags are the same as for fplExecuteScript().
  320.  
  321.    RESULT
  322.     The error number, or zero (0) if everything was ok.
  323.  
  324.    INPUTS
  325.     void *key        - Return code from fplInit().
  326.     char *filename        - Pointer to the filename.
  327.     unsigned long *tags     - Pointer to a tag list.
  328.  
  329.    SEE ALSO
  330.     fplExecuteScript()
  331.  
  332. fpl.library/fplGetErrorMsg                        fpl.library/fplGetErrorMsg
  333.  
  334.    NAME
  335.     fplGetErrorMsg -- get error message from error number.
  336.  
  337.    SYNOPSIS
  338.     char *fplGetErrorMsg( key, errnum, buffer );
  339.     D0                A0   D0      A1
  340.  
  341.    FUNCTION
  342.     To get a verbose error message from the error number returned by
  343.     fplExecuteScript() or fplExecuteFile().
  344.     Giving this function a error number out of range, will cause the
  345.     library to return "Unknown" error. The buffer given to hold the error
  346.     message must be at least FPL_ERRORMSG_LENGTH bytes long.
  347.  
  348.    NOTE
  349.     This should since V9 be replaced with the FPLTAG_ERROR_BUFFER tag to
  350.     fplInit()!
  351.  
  352.    RESULT
  353.     A pointer to a zero terminated string.
  354.  
  355.    INPUTS
  356.     void *key    - The return code of the initial fplinit() call.
  357.     long errnum    - Error number to get error message for.
  358.     char *buffer    - Buffer to store message in.
  359.  
  360.    SEE ALSO
  361.     fplExecuteScript(), fplExecuteFile()
  362.  
  363. fpl.library/fplAddFunction                   fpl.library/fplAddFunction
  364.  
  365.    NAME
  366.     fplAddFunction -- add function to be recognized by FPL.
  367.     fplAddFunctionTags -- add function to be recognized by FPL.
  368.  
  369.    SYNOPSIS
  370.     long fplAddFunction( key, name, ID, ret, format, tags );
  371.     D0                   A0   A1    D0  D1   A2      A3
  372.  
  373.     For SAS/C users:
  374.     long fplAddFunctionTags( key, name, ID, ret, format, ... );
  375.  
  376.    FUNCTION
  377.     This function adds a function to the FPL internal list of functions
  378.     to accept. All data pointed to by the different pointers here, must
  379.     remain unmodified (or at least existent, they may be changed any time
  380.     but the proper syntax must be respected) while FPL runs.
  381.  
  382.     DO NOT add function identifiers with names longer than 64 characters.
  383.     Such function won't be recognized in an FPL program.
  384.  
  385.     This function will be remembered as a function by FPL until fplFree()
  386.     (or fplDelFunction() naming this function) is invoked.
  387.  
  388.     To achieve dynamic function names which might change during the
  389.     execution or from one execution time to the next, you can call this
  390.     function whenever you please and the function will be accepted when FPL
  391.     gets control again. To remove a function, use fplDelFunction(). You
  392.     can do this at _any_ time, even in the middle of an execution!)
  393.  
  394.     If you want to add a function with the same name as an internal
  395.     function, or simply replace it, just fplDelFunction() the internal
  396.     function and then add your own using that name!
  397.  
  398.    TAGS
  399.     * FPLTAG_FUNCDATA. This data is readable in the ->funcdata member of
  400.       the fplArgument structure whenever this function is invoked. This
  401.       gives you a great chance to pass local data between here and your
  402.       interface function.
  403.  
  404.     * FPLTAG_FUNCTION. This is a function specific function pointer to be
  405.       called when this function is found in the FPL program. This enables
  406.       unique function calls for each function you add to FPL. The function
  407.       specified is called with the same argument and permissions as the
  408.       `global' interface function.
  409.  
  410.    RESULT
  411.     Zero if success, error code if failure.
  412.  
  413.    INPUTS
  414.     void *key    - This is the data received from the initial
  415.               fplInit() function call.
  416.  
  417.     char *name    - Pointer to a zero terminated string holding the
  418.               name of the function to add.
  419.  
  420.     long ID        - Function ID. May be set to whatever you please to
  421.               speed up function checks in the interface function.
  422.               All subzero values are reserved for FPL use and
  423.               calls.
  424.  
  425.     char ret    - FPL_STRARG or FPL_INTARG depending on if this
  426.               function is to return a string or an int to the
  427.               caller. FPL_OPTARG means that the function can
  428.               return either a string or an int. The return type
  429.               is determined by FPL at run time, and you help a
  430.               lot by *always* returing values from such functions
  431.               since each fplSend() will tell FPL the kind of the
  432.               return value.
  433.  
  434.     char *format    - This is a pointer to a zero terminated array holding
  435.               the argument specifiers for this function. You can
  436.               make your function receive for types of arguments:
  437.               strings, integers, string variables or integer
  438.               variables. You can also specify optional parameters
  439.               and/or parameter list. Available argument types are
  440.               - 'S' (required 'string')
  441.               - 's' (optional 'string')
  442.               - 'I' (required 'int')
  443.               - 'i' (optional 'int')
  444.               - 'O' (required 'S' or 'I')
  445.               - 'o' (optional 's' or 'i')
  446.               - '>' (optional number of the previous type
  447.                     can be specified)
  448.  
  449.               From version 9, these are also available:
  450.               - 'N' (required 'int' reference)
  451.               - 'n' (optional 'int' reference)
  452.               - 'C' (required 'string' reference)
  453.               - 'c' (optional 'string' reference)
  454.               - 'R' (required 'N' or 'C')
  455.               - 'r' (optional 'n' or 'c')
  456.               - 'A' (required 'S', 'I', 'N' or 'C')
  457.               - 'a' (optional 's', 'i', 'n' or 'c')
  458.  
  459.               From version 10, these are also available:
  460.               - 'B' (required 'string array reference')
  461.               - 'b' (optional 'string array reference')
  462.               - 'D' (required 'int array reference')
  463.               - 'd' (optional 'int array reference')
  464.  
  465.               NOTE: the optional kinds *must* be specified to the
  466.               right of the required ones!
  467.  
  468.               Examples:
  469.  
  470.               "ISi"
  471.               means one required int, one required string
  472.               and one optional int.
  473.  
  474.               "Si>"
  475.               means one required string and any number of
  476.               optional ints.
  477.  
  478.     unsigned long *tags - Pointer to a tag list. See TAGS
  479.  
  480.    SEE ALSO
  481.     fplDelFunction()
  482.  
  483. fpl.library/fplAddVariable                      fpl.library/fplAddVariable
  484.  
  485.    NAME
  486.     fplAddVariable -- add variable to be recognized by FPL.
  487.     fplAddVariableTags -- add variable to be recognized by FPL.
  488.  
  489.    SYNOPSIS
  490.     long fplAddVariable( key, name, ID, type, default, tags );
  491.     D0                   A0   A1    D0  D1   A2       A3
  492.  
  493.     For SAS/C users:
  494.     long fplAddVariableTags( key, name, ID, type, default, ... );
  495.  
  496.    FUNCTION
  497.     This function adds a variable to the FPL internal list of variables
  498.     to accept. The name pointed to by the 'name' pointer here, must
  499.     remain unmodified while FPL runs.
  500.  
  501.     DO NOT add variables with names longer than 64 characters.
  502.     Such a variable won't be recognized in an FPL program.
  503.  
  504.     The variable will appear as any regular 'const' variable to the FPL
  505.     programmer. That is, it is read-only and any assign of such a
  506.     variable results in an error.
  507.  
  508.     This variable will be remembered as a function by FPL until fplFree()
  509.     (or fplDelFunction() naming this variable) is invoked.
  510.  
  511.    TAGS
  512.     No tags are currently (V10) supported!
  513.  
  514.    RESULT
  515.     Zero if success, error code if failure.
  516.  
  517.    INPUTS
  518.     void *key    - This is the data received from the initial
  519.               fplInit() function call.
  520.  
  521.     char *name    - Pointer to a zero terminated string holding the
  522.               name of the function to add.
  523.  
  524.     long ID        - Variable ID. May be set to whatever you please to
  525.               speed up variable checks in the interface function.
  526.               All subzero values are reserved for FPL use and
  527.               calls. NOTE that variables and functions ought to
  528.               get different IDs to prevent mixups!!
  529.  
  530.     char type    - FPL_STRARG or FPL_INTARG depending on the intended
  531.               type of this variable. No other type is valid!
  532.  
  533.     void *default    - Default value of the variable. If this is a string
  534.               that's added, this should point to a zero terminated
  535.               string that's copied into the new variable, and if
  536.               this is an integer variable, it should be an
  537.               integer!
  538.  
  539.     unsigned long *tags - Pointer to a tag list. See TAGS
  540.  
  541.    SEE ALSO
  542.     fplAddFunction(), fplDelFunction()
  543.  
  544. fpl.library/fplDelFunction                       fpl.library/fplDelFunction
  545.  
  546.    NAME
  547.     fplDelFunction -- remove function definition.
  548.  
  549.    SYNOPSIS
  550.     long fplDelFunction( key, name );
  551.     D0                   A0   A1
  552.  
  553.    FUNCTION
  554.     As the name hints you about, this function removes a named
  555.     function from the FPL internal identifier cach. After this
  556.     call the named function will no longer be recognized.
  557.  
  558.     You can do this with any of the internal FPL functions too,
  559.     which has to be done if you want to add your own function
  560.     using the same name as a FPL internal function (or replacing
  561.     it with one which you think work better).
  562.  
  563.     NOTE: You don't have to fplDelFunction() every function you
  564.     have fplAddFunction()'ed. fplFree() will take care of that
  565.     for you.
  566.  
  567.    RESULT
  568.     Zero if everything was ok, otherwise an error code.
  569.  
  570.    INPUTS
  571.     void *key    - The return code of the initial fplInit().
  572.     char *name    - Pointer to the function name (zero terminated).
  573.  
  574.    SEE ALSO
  575.     fplAddFunction(), fplAddVariable()
  576.  
  577. fpl.library/fplFree                                     fpl.library/fplFree
  578.  
  579.    NAME
  580.     fplFree -- clean up all resources used by FPL.
  581.  
  582.    SYNOPSIS
  583.     void fplFree( key );
  584.               A0
  585.  
  586.    FUNCTION
  587.     When you have used FPL for the last time in your program, use
  588.     this function to make FPL free it's internal buffers and resources.
  589.     This call will make the data received from the initial fplInit()
  590.     useless.
  591.  
  592.     NOTE: You do not have to make a fplDelFunction() for every
  593.     function you've added. It's enough with a call to fplFree().
  594.  
  595.     NOTE2: If you intend to use FPL again in the same session, avoid
  596.     the overhead of doing fplFree() after every invoke of an FPL program.
  597.     My suggestion is, in all normal cases, an fplInit() call when starting
  598.     your program and an fplFree() call just before you exit it.
  599.  
  600.    INPUTS
  601.     void *key    - The return code of the initial fplInit().
  602.  
  603.    SEE ALSO
  604.     fplInit()
  605.  
  606. fpl.library/fplInit                                    fpl.library/fplInit
  607.  
  608.    NAME
  609.     fplInit -- intializes an FPL usage session.
  610.  
  611.    SYNOPSIS
  612.     void *fplInit( function, tags );
  613.  
  614.     void *fplInitTags( function, ... );
  615.  
  616.    FUNCTION
  617.     This function initializes the FPL internal buffers and caches and
  618.     allocates the new stack to use when the library is invoked.
  619.     This function *MUST* be called the first thing you do when you want
  620.     to use any functions in FPL. The return code of this function is
  621.     used as parameters in several of the other FPL functions. Can be called
  622.     several times using the same library base if wanted.
  623.  
  624.     Each call to fplInit() should have a corresponding call to fplFree().
  625.  
  626.    TAGS
  627.     FPLTAG_ALLFUNCTIONS                    (V5.3)
  628.       This tag enables/disables the FPL_UNKNOWN_FUNCTION ID. If that ID is
  629.       sent to the interface function, it means that the function just
  630.       interpreted was not found in the FPL internal lists. When this tag
  631.       is enabled, all function names will always be interpreted as best as
  632.       it can be done, no functions will be reported as "identified
  633.       unknown". Default is disabled.
  634.  
  635.     FPLTAG_HASH_TABLE_SIZE                    (V5)
  636.       Specified the size of the hash table to use. Default is 67, and any
  637.       size below 10 is ignored. Set this *ONLY* at the fplInit() call!!!
  638.       Highest performance will be achieved if this is a prime number.
  639.  
  640.     FPLTAG_INTERVAL
  641.       Specifies the interval function which is called every now and then
  642.       to enable external processes to stop the FPL program. Returning
  643.       non-zero stops the program with a FPL_PROGRAM_STOPPED error code.
  644.  
  645.     FPLTAG_NEWLINE_HOOK
  646.       Obsolete from version 9!
  647.  
  648.     FPLTAG_USERDATA
  649.       Data to send to the interval function. Readable with the
  650.       FPLSEND_USERDATA tag to the fplSend() function.
  651.  
  652.     FPLTAG_INTERNAL_ALLOC                    (V3)
  653.       With this tag you specify a function pointer that will be called
  654.       instead of the internal AllocMem()/malloc() function. This has to be
  655.       a "void *(*function)(long size, void *userdata)" function. Amiga
  656.       programmers will find the size argument in register D0 and the
  657.       userdata in A0.
  658.  
  659.       When using this, all FPL allocations will be made using this
  660.       function, although FPL has it's own memory caching/recycling system.
  661.  
  662.     FPLTAG_INTERNAL_DEALLOC                    (V3)
  663.       Specifies a function pointer to be called instead of the internal
  664.       FreeMem()/free() function. The function must be a
  665.       "void (*function)(void *pointer, long size, void *userdata)"
  666.       function. Amiga programs will receive the arguments in A1 and D0
  667.       (just as FreeMem() wants them...) and userdata in A0.
  668.  
  669.     FPLTAG_CACHEALLFILES                    (V3)
  670.       Turn on or off default FPL caching. Default is FPLCACHE_NONE.
  671.  
  672.       Cashing can be done in three ways:
  673.       FPLCACHE_NONE    - Will never ever cache a file
  674.       FPLCACHE_ALWAYS  - Will cache files that have one or more global
  675.                  symbols
  676.       FPLCACHE_EXPORTS - Will only cache files that have exported symbols.
  677.  
  678.       (The execute tag 'FPLTAG_CACHEFILE' can change this on a single
  679.       program basis. FPLTAG_CACHEALLFILES sets the default cache switch.)
  680.  
  681.       NOTE: Files that do not declare any global symbols will not be
  682.       cached, no matter what this tag says!
  683.  
  684.     FPLTAG_REREAD_CHANGES                    (V8)
  685.       Suppy a boolean to switch this default to on/off. When enabled all
  686.       files that are attempted to be ran with the actual file modified on
  687.       disk, will get all symbols declared in the file removed and the new
  688.       version loaded and run instead.
  689.  
  690.       * Individual files can be altered with the same tag to
  691.         fplExecuteScript() and fplExcuteFile().
  692.       * This can be forced on/off with the pragmas 'reread' and 'noreread'
  693.         inside the FPL program.
  694.       * This tag will only be of use for calls to fplExecuteFile().
  695.  
  696.     FPLTAG_FLUSH_NOT_IN_USE                    (V8)
  697.       Suppy a boolean to switch this default to on/off. When enabled, all
  698.       files that aren't in use will be flushed from memory and read into
  699.       memory again when accessed.
  700.  
  701.       * Individual files can be altered with the same tag to
  702.         fplExecuteScript() and fplExcuteFile().
  703.       * This can be forced with the pragmas 'cache' and 'nocache'
  704.         inside the FPL program. They force the file to remain in memory
  705.         or not.
  706.  
  707.     FPLTAG_IDENTITY                        (V9)
  708.       During debug mode, a possible external debugger should get a real
  709.       name of each FPL using process that keeps them apart. All users
  710.       of FPL should make the supplied pointer to this tag point to a
  711.       unique string as an ID of this process.
  712.       FPL will *not* copy any data from the pointer, but simply read from
  713.       it from time to time. NULL is the same as not specifying anything.
  714.  
  715.     FPLTAG_DEBUG                        (V9)
  716.       See the tag with the name name under the fplExecuteScript()
  717.       description!
  718.  
  719.     FPLTAG_KIDNAP_CACHED                    (V9)
  720.       See the tag with the name name under the fplExecuteScript()
  721.       description!
  722.  
  723.     FPLTAG_ERROR_BUFFER                    (V9)
  724.       The supplied char pointer should point to at least
  725.       FPL_ERRORMSG_LENGTH free bytes. If FPL encounters an error, this
  726.       buffer will be filled with a zero terminated error message string
  727.       just before the FPL_GENERAL_ERROR message is sent to the interface
  728.       function!
  729.       This tag should be used *prior* to the fplGetErrorMsg() function
  730.       which from now on is declared not-to-be-used.
  731.  
  732.     FPLTAG_PREVENT_RUNNING_SAME                (V10)
  733.       If this tag is set to TRUE, no programs are allowed to get executed
  734.       a second time (that is, if the program is already cashed).
  735.       The FPLTAG_REREAD_CHANGES tag still works fine with this though.
  736.  
  737.  
  738.       Amiga-only tags:
  739.  
  740.     FPLTAG_STACK
  741.       Startup stack size. Any size below 8000 bytes is ignored!
  742.  
  743.     FPLTAG_MAXSTACK.
  744.       After one execution with possible stack expandings, this specified
  745.       size is the maximum memory area that still will be allocated by FPL
  746.       to use in the next execution as stack. (This is done like this to
  747.       prevent FPL to have to enlarge the stack on every execution if
  748.       memory is available!) Default is 20000 bytes.
  749.  
  750.     FPLTAG_STACKLIMIT.
  751.       The very largest memory size that FPL is permitted to use as stack.
  752.       This prevents the user of writing too recursive FPL programs. Try a
  753.       few programs to see which setting you think fits best in your
  754.       surrounding. Default is 40000 bytes.
  755.  
  756.     FPLTAG_MINSTACK.
  757.       Obsolete!
  758.  
  759.     FPLTAG_LOCKUSED.
  760.       This tag makes FPL to keep the lock on a file until it doesn't need
  761.       the file anymore. Using this tag enables a higher security level of
  762.       the FPL environment since no files can be removed or changed while
  763.       they are needed by FPL. Locks will be removed when the program is
  764.       not necessary any more or when fplFree() is called.
  765.  
  766.    NOTE
  767.     *WARNING* FPLTAG_INTERNAL_ALLOC and FPLTAG_INTERNAL_DEALLOC can be
  768.     patched run-time. If you do that, memory that has been allocated using
  769.     the first function, might get freed by the new patch. This can be
  770.     looked upon as a bug, but sure as well a feature. THESE TAGS MUST BE
  771.     USED WITH CAUTION!
  772.  
  773.    RESULT
  774.     Non-zero if everything was ok, otherwise NULL. This return code is used
  775.     as input to all other FPL functions. Don't mess with it!
  776.  
  777.     The return code will remain the same during the entire FPL session.
  778.     That enables you to store this in a global variable to be able to reach
  779.     it everywhere without problems.
  780.  
  781.    INPUTS
  782.     long (*function)(struct fplArgument*) - Pointer to the interface
  783.                         function.
  784.     unsigned long *tags              - Taglist pointer!
  785.  
  786.    SEE ALSO
  787.     fplReset(), fplFree()
  788.  
  789. fpl.library/fplReset                                    fpl.library/fplReset
  790.  
  791.    NAME
  792.     fplReset -- reset tags set in the fplInit() call.
  793.     fplResetTags -- reset tags set in the fplInit() call.
  794.  
  795.    SYNOPSIS
  796.     long fplReset( key, tags );
  797.     D0           A0   A1
  798.  
  799.     For SAS/C users:
  800.     long fplResetTags( key, ... );
  801.  
  802.    FUNCTION
  803.     This function is used to set fplInit() tags, after the fplInit() call.
  804.     If you'd like to change any given data or perhaps add a tag dynamically
  805.     between two FPL runs, this is the function for you!
  806.  
  807.    TAGS
  808.     All fplInit() tags are available.
  809.  
  810.    RESULT
  811.     Zero if ok, otherwise a non-zero error code!
  812.  
  813.    INPUTS
  814.     void *key        - The return code of the initial fplInit().
  815.     unsigned long *tags    - Taglist pointer!
  816.  
  817.    SEE ALSO
  818.     fplInit()
  819.  
  820. fpl.library/fplSend                                     fpl.library/fplSend
  821.  
  822.    NAME
  823.     fplSend -- multi purpose FPL communication.
  824.     fplSendTags -- multi purpose FPL communication.
  825.  
  826.    SYNOPSIS
  827.     long fplSend( key, tags );                (V3)
  828.     D0            A0   A1
  829.  
  830.     For SAS/C users:
  831.     long fplSendTags( key, ... );
  832.  
  833.    FUNCTION
  834.     There is always communication between FPL and the host program. FPL
  835.     communicates by calling the interface function, you answer by calling
  836.     fplSend() with different arguments. This is the general function for
  837.     responding to, or getting information from, FPL.
  838.  
  839.     To return values to FPL from the interface function use this. Only use
  840.     one of the data sending tags in the same function call (tags marked
  841.     with "**").
  842.  
  843.     The tags are read in the same order as sent. That means that you can,
  844.     in cases where you should specify several tags, rely on the evaluation
  845.     order and specify them all in one call.
  846.  
  847.  
  848.  
  849.    TAGS
  850.     (Tags marked with two asterisks "**", are mutely exclusive. That means
  851.     you may only specify one of those in each fplSend() call!)
  852.  
  853.     ** FPLSEND_CONFIRM
  854.       Used to confirm or deny an FPL action. This tag answers TRUE or
  855.       FALSE. Ex: when a program supplied by you is allowed and about to be
  856.       flushed, FPL will call you with the FPL_FLUSH_FILE ID and you must
  857.       return a positive confirmation if you flushed.
  858.  
  859.     ** FPLSEND_STRING
  860.       Sends a string pointer for FPL to copy. Use this only if the current
  861.       function is supposed to return a string. See also the FPLSEND_STRLEN
  862.       tag. A NULL pointer is treated the same as a pointer to a zero length
  863.       string.
  864.  
  865.       FPLSEND_STRLEN
  866.       Used together with FPLSEND_STRING. This informs FPL about the length
  867.       of the sent string. If you set this to a negative number (or don't
  868.       set it at all), FPL will perform a strlen() on the associated string
  869.       pointer to get the length of it.
  870.  
  871.       FPLSEND_DONTCOPY_STRING                (V6)
  872.       Enter TRUE/FALSE, default is FALSE. Use this tag if the string sent
  873.       to FPL is allocated with fplAllocString(). That will tell FPL to not
  874.       duplicated the entered string, but instead using it as it is. Do not
  875.       modify the string in any way after calling fplSend() with this tag.
  876.  
  877.     ** FPLSEND_INT
  878.       Sends an integer value to FPL. Use this only if the current function
  879.       is supposed to return an integer.
  880.  
  881.     * FPLSEND_FLUSHCACHE
  882.       Tells FPL to flush (empty) all internal memory caches. This will
  883.       bring more free memory to the system, but also make FPL require a
  884.       larger number of allocations.
  885.  
  886.     * FPLSEND_FLUSHFILE
  887.       If a file name is specified, that file will be flushed from memory if
  888.       not in use and not previously flushed. Specifying zero (0) will
  889.       flush all files in memory that fits the same description. Even files
  890.       that have been declared to remain cached will be flushed when this is
  891.       used.
  892.  
  893.     * FPLSEND_FREEFILE
  894.       Deletes all functions that are currently associated with the file
  895.       name you specify as data to this tag.
  896.  
  897.     * FPLSEND_GETCOLUMN
  898.       Supply a pointer to a `long' to receive the number of the current
  899.       column the interpreter is working on.
  900.       NOTE: If using fplExecuteFile(), the program will always be read as
  901.       if it was on one single line which will make the column number to be
  902.       very large sometimes.
  903.  
  904.     * FPLSEND_GETFUNCTION                    (V5)
  905.       Supply a pointer to a fuunction pointer to receive the pointer to
  906.       the current interface function.
  907.  
  908.     * FPLSEND_GETINTERVAL                    (V5)
  909.       Supply a pointer to a fuunction pointer to receive the pointer to
  910.       the current interval function.    
  911.  
  912.     * FPLSEND_GETLINE
  913.       Supply a pointer to a `long' to receive the number of the current
  914.       line the interpreter is working on.
  915.       NOTE: If using fplExecuteFile(), the program will always be read as
  916.       if it was on one single line which will make this tag always return
  917.       1.
  918.  
  919.     * FPLSEND_GETNEWLINE_HOOK                (V5)
  920.       Supply a pointer to a fuunction pointer to receive the pointer to
  921.       the current newline hook function.    
  922.  
  923.     * FPLSEND_GETPROG                    (V5)
  924.       Supply a pointer to a char pointer and you'll receive a pointer to
  925.       the current (now interpreting or last interpreted) program. If the
  926.       program wasn't accesible by some reason, a NULL pointer will be
  927.       returned. Use this for e.g. count the lines of a program loaded
  928.       with fplExecuteFile().
  929.  
  930.     * FPLSEND_GETPROGNAME
  931.       Supply a pointer to a char pointer and you'll receive a pointer to
  932.       the current (now interpreting or last interpreted) program name.
  933.       (See also the FPLTAG_PROGNAME tag for the fplExecute#? functions.)
  934.  
  935.     * FPLSEND_GETRESULT
  936.       Supply a pointer to a 'long' to receive the number returned by the
  937.       last interval function call.
  938.  
  939.     * FPLSEND_GETRETURNCODE
  940.       Supply a pointer to a `long' to receive the value returned in the
  941.       last return() or exit() call in the FPL program.
  942.  
  943.     * FPLSEND_GETRETURNINT                    (V10)
  944.       Supply a pointer to a `long *' to receive a pointer to the value
  945.       returned in the last return() or exit() call in the FPL program.
  946.       If no value was returned, this will return NULL.
  947.  
  948.     * FPLSEND_GETSTACKSIZE
  949.       (Amiga only) Supply a pointer to a `long' to receive the current
  950.       stack size.
  951.  
  952.     * FPLSEND_GETSTACKUSED
  953.       (Amiga only) Supply a pointer to a `long' to receive the current
  954.       amount stack used.
  955.  
  956.     * FPLSEND_GETSYMBOL_FUNCTIONS
  957.       FPLSEND_GETSYMBOL_MYFUNCTIONS
  958.       FPLSEND_GETSYMBOL_FPLFUNCTIONS
  959.       FPLSEND_GETSYMBOL_VARIABLES
  960.       FPLSEND_GETSYMBOL_CACHEDFILES
  961.       FPLSEND_GETSYMBOL_ALLVARIABLES            (V5)
  962.       FPLSEND_GETSYMBOL_ALLFUNCTIONS            (V5)
  963.  
  964.       Supply a struct fplSymbol ** (pointer to a fplSymbol struct pointer)
  965.       and receive data about the current FPL status!
  966.  
  967.       FUNCTIONS means all exported and external functions
  968.       MYFUNCTIONS means only all external functions
  969.       FPLFUNCTIONS means only by FPL exported functions.
  970.       VARIABLES means all exported variables
  971.       CACHEDFILES means all cached files' names
  972.       ALLVARIABLES means *all* current variables even locals
  973.       ALLFUNCTIONS means *all* current functions even locals
  974.  
  975.       FPLSEND_GETSYMBOL_FREE
  976.       Must be called after each of the above with the fplSymbol pointer as
  977.       data.
  978.  
  979.     * FPLSEND_GETUSERDATA
  980.       Supply a pointer to a `long' to receive the userdata specified in the
  981.       `FPLTAG_USERDATA' tag's data field in the fplInit() call. If that
  982.       tag wasn't specified, NULL is returned.
  983.  
  984.     * FPLSEND_GETVIRLINE                    (V5.3)
  985.       Supply a pointer to a `long' to receive the virtual line number.
  986.       The virtual line number is in normal cases the desired line number
  987.       you want. It is simply a counter of the amount of newlines from the
  988.       top of the file to the current position.
  989.  
  990.       See also: #line instruction in FPLuser.guide
  991.  
  992.     * FPLSEND_GETVIRFILE                    (V5.3)
  993.       Supply a pointer to a char pointer, and you'll receive the virtual
  994.       file name. The virtual file name is usually the name of the current
  995.       file. The file name is zero terminated if it's _not_ started with a
  996.       quotation mark. If a quotation mark is the first character of the
  997.       file name, the file name is also ended with a quotation mark and
  998.       not with a zero byte! After a program execution, this will return
  999.       NULL!
  1000.  
  1001.       See also: #line instruction in FPLuser.guide
  1002.  
  1003.     * FPLSEND_PROGRAMFILE
  1004.       When using non-cached files and FPL requires a file using the
  1005.       FPL_FILE_REQUEST, you return the file name where FPL can load the
  1006.       FPl program using this tag. The program must not been changed since
  1007.       FPL played with it last time!
  1008.       The name must be zero terminated.
  1009.  
  1010.     ** FPLSEND_PROGRAM
  1011.       When using non-cached files and FPL requires a file using the
  1012.       FPL_FILE_REQUEST, you return the program array pointer using this
  1013.       tag. The program must not been changes since FPL played with it last
  1014.       time!
  1015.  
  1016.     * FPLSEND_SETPROGNAME
  1017.       Supply a pointer to the new name of the current program.
  1018.       See FPLTAG_PROGNAME.
  1019.  
  1020.     * FPLSEND_SETFILENAMEGET
  1021.       Supply a boolean whether FPL can get flushed file from the file named
  1022.       as the program name. See FPLTAG_FILENAMGET.
  1023.  
  1024.     * FPLSEND_STEP
  1025.       Moves the current interpret position forward or backward a number of
  1026.       characters. Especially when a FPL_WARNING is received, this function
  1027.       might be useful. For example, if a FPL_MISSING_BRACKET occurs on a
  1028.       line like `foobar[2[="username"'; The warning will appear at the
  1029.       postion          ^ and try to continue there if a confirm is sent
  1030.       back. A continuation that will lead to a dead end error if the
  1031.       interpret position isn't moved first one character forward.
  1032.  
  1033.       Using a negative number moves it backwards, positive forwards.
  1034.  
  1035.       If the beginning, or end, of program was reached, FPL_UNEXPECTED_END
  1036.       is returned.
  1037.  
  1038.       WARNING! This must be used with common sense! Moving the interpret
  1039.       position without a reason as above or similar, will deeply confuse
  1040.       FPL, which likely starts reporting mysterious errors and in other
  1041.       ways act strange.
  1042.  
  1043.     * FPLSEND_RESULT                    (V10)
  1044.       Supply a pointer to a long that fplSend() can use to store extra
  1045.       return code informations in! The adress will be remembered by FPL
  1046.       and repeated calls with the tags that use this do not need to set
  1047.       this!
  1048.  
  1049.     * FPLSEND_IS_FILE_CACHED                (V10)
  1050.       Supply a pointer to the program name. The long to which the
  1051.       FPLSEND_RESULT tag points to will hold TRUE if the program is
  1052.       cached, and FALSE if it isn't.
  1053.  
  1054.    RESULT
  1055.     Zero if ok, otherwise a standard FPL error code.
  1056.  
  1057.    INPUTS
  1058.     void *key    - The return code of the fplInit() call.
  1059.     unsigned long *    - A taglist pointer.
  1060.  
  1061.    SEE ALSO
  1062.  
  1063. fpl.library/fplAlloc                                 fpl.library/fplAlloc
  1064.  
  1065.    NAME
  1066.     fplAlloc -- allocate memory and bind to the FPL resource list.
  1067.  
  1068.    SYNOPSIS
  1069.     void *fplAlloc( key, size );             (V3)
  1070.     D0        A0   D0
  1071.  
  1072.    FUNCTION
  1073.     This function allocates memory and attaches it to the current internal
  1074.     list of memory used in this FPL session. All memory in that list will
  1075.     be freed at the fplFree() call. Single memory areas allocated with this
  1076.     function can be freed with fplDealloc().
  1077.  
  1078.     If you have patched the FPL allocation routine, this will eventually
  1079.     call that function to allocate.
  1080.  
  1081.     This allocation works like the C language malloc(), which means that it
  1082.     always allocates 12 extra bytes to store allocation information in.
  1083.  
  1084.     Future versions of FPL might get special fplSend() tags to use if you
  1085.     have fplAlloc()'ed memory that you send to it to reduce the situations
  1086.     where you allocate memory for a string, send it to FPL which allocates
  1087.     again and copies your data, and then you free your memory again... One
  1088.     too many allocations I think!
  1089.  
  1090.    RESULT
  1091.     A pointer to an allocated memory area, or NULL if the allocation
  1092.     failed.
  1093.  
  1094.    INPUTS
  1095.     void *key    - The return code of the fplInit() call.
  1096.     unsigned long     - Size of allocation.
  1097.  
  1098.    SEE ALSO
  1099.     fplAlloca(), fplDealloc(), fplDealloca()
  1100.  
  1101. fpl.library/fplDealloc                                fpl.library/fplDealloc
  1102.  
  1103.    NAME
  1104.     fplDealloc -- deallocated memory allocate with fplAlloc().
  1105.  
  1106.    SYNOPSIS
  1107.     void fplDealloc( key, pointer );         (V3)
  1108.              A0   A1
  1109.  
  1110.    FUNCTION
  1111.     This function frees memory previously allocated by fplAlloc(). Using
  1112.     this on memory allocated by any other memory will trash memory and
  1113.     the resulting happenings are really not known!
  1114.  
  1115.     If you have patched the FPL deallocation routine, this will eventually
  1116.     call that function to free.
  1117.  
  1118.    INPUTS
  1119.     void *key    - The return code of the fplInit() call.
  1120.     void *pointer     - Pointer to a previosly fplAlloc()'ed memory area.
  1121.  
  1122.    SEE ALSO
  1123.     fplAlloca(), fplAlloc(), fplDealloca()
  1124.  
  1125. fpl.library/fplAlloca                                fpl.library/fplAlloca
  1126.  
  1127.    NAME
  1128.     fplAlloca -- allocate memory and bind to the FPL program running.
  1129.  
  1130.    SYNOPSIS
  1131.     void *fplAlloca( key, size );             (V4)
  1132.     D0         A0   D0
  1133.  
  1134.    FUNCTION
  1135.     This function allocates memory and attaches it to the current internal
  1136.     list of memory used for this FPL session. All memory in that list will
  1137.     be freed at the fplFree() call or when the current program exits.
  1138.     Single memory areas allocated with this function can be freed with
  1139.     fplDealloca().
  1140.  
  1141.     If you have patched the FPL allocation routine, this will eventually
  1142.     call that function to allocate, even though this allocation is using
  1143.     the internal FPL memory chaches, which might give us memory without
  1144.     calling that allocate function!
  1145.  
  1146.     This allocation works like the C language malloc(), which means that
  1147.     it always allocates 12 extra bytes to store allocation information in.
  1148.  
  1149.    RESULT
  1150.     A pointer to an allocated memory area, or NULL if the allocation
  1151.     failed.
  1152.  
  1153.    INPUTS
  1154.     void *key    - The return code of the fplInit() call.
  1155.     unsigned long     - Size of allocation.
  1156.  
  1157.    SEE ALSO
  1158.     fplAlloc(), fplDealloc(), fplDealloca()
  1159.  
  1160. fpl.library/fplDealloca                              fpl.library/fplDealloca
  1161.  
  1162.    NAME
  1163.     fplDealloca -- dealloc memory allocated with fplAlloca().
  1164.  
  1165.    SYNOPSIS
  1166.     void fplDealloca( key, pointer );         (V4)
  1167.               A0   A1
  1168.  
  1169.    FUNCTION
  1170.     This function frees memory previously allocated by fplAlloca(). Using
  1171.     this on memory allocated by any other memory will trash memory and
  1172.     the resulting happenings are really not known!
  1173.  
  1174.     If you have patched the FPL deallocation routine, this might eventually
  1175.     call that function to free if the memory area does not remain in the
  1176.     FPL memory cache.
  1177.  
  1178.    INPUTS
  1179.     void *key    - The return code of the fplInit() call.
  1180.     void *pointer     - Pointer to a previosly fplAlloca()'ed memory area.
  1181.  
  1182.    SEE ALSO
  1183.     fplAlloca(), fplDealloc(), fplAlloc()
  1184.  
  1185. fpl.library/fplAllocString                              fpl.library/fplAllocString
  1186.  
  1187.    NAME
  1188.     fplAllocString -- allocate memory for an FPL string.
  1189.  
  1190.    SYNOPSIS
  1191.     void *fplAllocString( key, size);         (V6)
  1192.                   A0   D0
  1193.  
  1194.    FUNCTION
  1195.     This function allocates memory and prepares the memory block for
  1196.     holding an FPL string. Using this to allocate memory and then
  1197.     using the 'FPLSEND_DONTCOPY_STRING' tag in the fplSend() call when
  1198.     sending the allocated string to FPL, tells FPL not to duplicate
  1199.     the sent string, but simply using the supplied one.
  1200.  
  1201.     Strings allocated with fplAllocString() should have a matching
  1202.     fplFreeString(). Note that when i.g, sending the string to FPL with
  1203.     the 'FPLSEND_DONTCOPY_STRING' tag, FPL will do the freeing and
  1204.     not the user program!
  1205.  
  1206.    INPUTS
  1207.     void *key    - The return code of the fplInit() call.
  1208.     long size    - The length of the string to create. Which is the
  1209.               same as the size of the memory block to get hands
  1210.               on.
  1211.  
  1212.    RESULT
  1213.     Returns a pointer to the requested memory area. The memory is set up
  1214.     to be used as an FPL string (but you won't notice that).
  1215.  
  1216.    EXAMPLE
  1217.     Previous code that send a string to FPL could look like:
  1218.         {
  1219.           char *data= malloc(1000); /* allocate */
  1220.           strcpy(data, otherdata);  /* copy data *
  1221.           fplSendTags(key, FPLSEND_STRING, data, TAG_DONE);
  1222.           /* FPL duplicates the data sent */
  1223.           free(data); /* free */
  1224.         }
  1225.  
  1226.     Code using the new fplAllocString() function could replace the
  1227.     old one like:
  1228.         {
  1229.           char *data = fplAllocString(key, 1000); /* allocate */
  1230.           strcpy(data, otherdata);  /* copy data */
  1231.           fplSendTags(key, FPLSEND_STRING, data,
  1232.                    FPLSEND_DONTCOPY_STRING, TRUE,
  1233.                    TAG_DONE);
  1234.           /* FPL uses the user's allocation, no extra duplication */
  1235.         }
  1236.  
  1237.    SEE ALSO
  1238.     fplAlloc(), fplFreeString()
  1239.  
  1240. fpl.library/fplFreeString                              fpl.library/fplFreeString
  1241.  
  1242.    NAME
  1243.     fplFreeString -- free FPL string memory.
  1244.  
  1245.    SYNOPSIS
  1246.     void fplFreeString( key, string);         (V6)
  1247.                  A0   A1
  1248.  
  1249.    FUNCTION
  1250.     This function frees the memory associated with an FPL string. Other
  1251.     memory areas should and can not be freed with this function. Such an
  1252.     attempt will most likely damage running programs.
  1253.  
  1254.     This function should be called after each call to fplAllocString().
  1255.  
  1256.    INPUTS
  1257.     void *key    - The return code of the fplInit() call.
  1258.     char *string    - The return code an fplAllocString() call.
  1259.  
  1260.    EXAMPLE
  1261.     When using the fplExecuteScript() tag 'FPLTAG_STRING_RETURN' the
  1262.     returned string should be freed using fplFreeString():
  1263.         {
  1264.           char *string;
  1265.           fplExecuteScriptTags(key, array, lines,
  1266.                        FPLTAG_STRING_RETURN, &string,
  1267.                        FPLTAG_DONE);
  1268.           if(string) {
  1269.             printf("The program returned '%s'\n", string);
  1270.             fplFreeString(key, string); /* free string */
  1271.           }
  1272.           else
  1273.             printf("No string returned!\n");
  1274.         }
  1275.  
  1276.    SEE ALSO
  1277.     fplDealloc(), fplAllocString()
  1278.  
  1279. fpl.library/fplOpenLib                              fpl.library/fplOpenLib
  1280.  
  1281.    NAME
  1282.     fplOpenLib -- open funclib.
  1283.  
  1284.    SYNOPSIS
  1285.     long fplOpenLib( key, funclib, version, flags);         (V7)
  1286.              A0   A1       D0       D1
  1287.  
  1288.    FUNCTION
  1289.     Opens a funclib. This does mainly the same as the 'openlib' FPL
  1290.     function. Good to use when you want your software to open funclibs
  1291.     as default. Funclibs opened with this function can be made impossible
  1292.     to close from FPL (see the flags parameter).
  1293.  
  1294.     If the funclib is already opened, the open counter is simply
  1295.     increased.
  1296.  
  1297.    INPUTS
  1298.     void *key    - The return code of the fplInit() call.
  1299.     char *funclib    - The name of the funclib to open.
  1300.     long version    - The lowest acceptable funclib version.
  1301.     long flags    - Extra open information. These flags are available:
  1302.  
  1303.     FPLLIB_KEEP: A funclib opened with this flag set cannot be closed with
  1304.     an ordinary 'closelib' but must be closed using the FPLLIB_FORCE flag
  1305.     to fplCloseLib()!
  1306.  
  1307.    RESULT
  1308.     Zero if ok. If the result is a positive number it is a standard FPL
  1309.     error code, and if it is a negative number, it is an error code
  1310.     returned from the funclib. The numbers mean:
  1311.     -1 = the funclib was called with an illegal parameter
  1312.     -2 = funclib internal error
  1313.     -3 = failed getting system resource (pipe, message port, etc)
  1314.     -4 = out of memory
  1315.     -5 = couldn't load funclib (most likely, the funclib is missing)
  1316.     -6 = the requested version didn't exist
  1317.  
  1318.     More error codes will be added in the future.
  1319.  
  1320.    EXAMPLE
  1321.     Make your program use the funclib "foobar" version 2 from startup:
  1322.         {
  1323.           long success;
  1324.           success = fplOpenLib(key, "foobar", 2, FPLLIB_NONE);
  1325.           if(0 == success)
  1326.             printf("We failed to opened the funclib!\n");
  1327.         }
  1328.  
  1329.    SEE ALSO
  1330.     fplCloseLib()
  1331.  
  1332. fpl.library/fplCloseLib                              fpl.library/fplCloseLib
  1333.  
  1334.    NAME
  1335.     fplCloseLib -- close funclib.
  1336.  
  1337.    SYNOPSIS
  1338.     long fplCloseLib( key, funclib, flags )             (V7)
  1339.               A0   A1       D0
  1340.  
  1341.    FUNCTION
  1342.     Closes a funclib. This does mainly the same as the 'closelib' FPL
  1343.     function. Good to use when you want your software to close funclibs.
  1344.     Funclibs opened with the FPLLIB_FORCE flag set can only be closed
  1345.     using this function.
  1346.  
  1347.     The funclib isn't entirely removed until the open counter of the
  1348.     funclib has reached zero. To force removal, without considering
  1349.     the open counter, the FPLLIB_FORCE flag must be used.
  1350.  
  1351.    INPUTS
  1352.     void *key    - The return code of the fplInit() call.
  1353.     char *funclib    - The name of the funclib to open. If set to NULL,
  1354.               *all* funclib will be closed.
  1355.     long flags    - Extra close options. These flags are available:
  1356.  
  1357.     FPLLIB_FORCE: A funclib opened with this flag set cannot be closed with
  1358.     an ordinary 'closelib' but must be closed using the FPLLIB_FORCE flag
  1359.     to fplCloseLib()!
  1360.  
  1361.    RESULT
  1362.     Zero if ok. If the result is a positive number it is a standard FPL
  1363.     error code, and if it is a negative number, it is an error code
  1364.     returned from the funclib. See fplOpenLib() for more details.
  1365.  
  1366.    EXAMPLE
  1367.     Make your program use the funclib "foobar" version 2 from startup:
  1368.         {
  1369.           long success;
  1370.           success = fplOpenLib(key, "foobar", 2, FPLLIB_NONE);
  1371.           if(0 == success)
  1372.             printf("We failed to opened the funclib!\n");
  1373.         }
  1374.  
  1375.    SEE ALSO
  1376.     fplCloseLib()
  1377.  
  1378. fpl.library/fplReference                            fpl.library/fplReference
  1379.  
  1380.    NAME
  1381.     fplReference -- handle variable references
  1382.  
  1383.    SYNOPSIS
  1384.     long fplReference( key, referID, tags)            (V9)
  1385.                A0   A1       A2
  1386.  
  1387.     For SAS/C users:
  1388.     long fplReferenceTags( key, referID, ...)
  1389.  
  1390.    FUNCTION
  1391.     Whenever an external function is called (through the regular
  1392.     interface function) and one or more of the parameters is a variable
  1393.     reference, this function can be used to read and write information
  1394.     about that variable.
  1395.  
  1396.    TAGS
  1397.     FPLREF_TYPE
  1398.       Supply this tag a pointer to a long, and this function will fill in
  1399.       the bits that matches this variable type! The bits that can be
  1400.       filled are:
  1401.       FPLREF_TYPE_STRING    - The symbol is a string
  1402.       FPLREF_TYPE_INTEGER    - The symbol is an integer
  1403.       FPLREF_TYPE_ARRAY    - The symbol is a variable array (V10)
  1404.  
  1405.       (no other are supported today, more are likely to appear in the
  1406.       future)
  1407.  
  1408.     FPLREF_NAME
  1409.       Supply this tag a pointer to a char pointer, and FPL will store a
  1410.       pointer to this variable's name in there. The name is a zero
  1411.       terminated string.
  1412.  
  1413.     FPLREF_GET_STRING
  1414.       If this variable is a string, supply a pointer to a char pointer,
  1415.       and FPL will store a pointer to this variable's contents in that,
  1416.       or NULL if it was an integer!
  1417.       The pointer will point to a regular FPL string, and the length
  1418.       of it is readable through the FPLSTRLEN() macro as usual.
  1419.  
  1420.     FPLREF_SET_STRING
  1421.       If this variable is a string, supply a pointer to a previously
  1422.       fplAllocString() string, and FPL will replace this variable's
  1423.       contents with this new string! The string MUST NOT be deallocated
  1424.       by the program, but FPL will take care of that.
  1425.  
  1426.     FPLREF_GET_INTEGER
  1427.       If this variable is an integer, supply a pointer to a long pointer,
  1428.       and FPL will store a pointer to the contents of this variable, or
  1429.       NULL if it wasn't an integer!
  1430.  
  1431.     FPLREF_SET_INTEGER
  1432.       If this variable is an integer, supply a long that will be stored
  1433.       as this variable's new contents!
  1434.  
  1435.     FPLREF_ARRAY_INFO                    (V10)
  1436.       Specify a pointer to a "struct fplRef" and information about the
  1437.       referenced array will be returned.
  1438.       The information pointed to by the 'ArraySize' field is READ-ONLY. Do
  1439.       not mess with that data!
  1440.  
  1441.     FPLREF_ARRAY_ITEM                    (V10)
  1442.       Suply a pointer to a long array terminated with a '-1' value,
  1443.       holding the array dimension information about which specified
  1444.       array item you wish to read/write. I.e if the array is an integer
  1445.       array declared as 'foobar[10][20]' and your program wants to modify
  1446.       the item 'foobar[5][6]', the array should look like {5, 6, -1}.
  1447.       By setting the array item first in the taglist, you can read and
  1448.       write single items with the usual (pre V10) tags!
  1449.  
  1450.     FPLREF_SET_MY_STRING                    (V10)
  1451.       Like FPLREF_SET_STRING except that this tag needs a regular char
  1452.       pointer to a regular memory area holding the string, no kind of
  1453.       FPL-string is required. The length of the strint is either read
  1454.       by FPL trough a strlen() call, or set with the tag below, before
  1455.       this tag in the taglist!
  1456.  
  1457.     FPLREF_SET_MY_STRLEN                    (V10)
  1458.       Supply the length of the string you're about to set with
  1459.       FPLREF_SET_MY_STRING. Use this tag before the strint set tag!
  1460.  
  1461.     FPLREF_ARRAY_RESIZE                    (V11)
  1462.       Supply a pointer to a filled in fplRef struct, and the referenced
  1463.       array will be resized according to your settings. Note that you
  1464.       are allowed to change number of dimenstions, allthough you're
  1465.       encouraged not to. It would confuse the users a lot!
  1466.       Resizing to smaller arrays may cause a loss of data that will be
  1467.       lost unrecoverable. See further in the keyword 'resize' paragragh!
  1468.  
  1469.    INPUTS
  1470.     void *key    - The return code of the fplInit() call.
  1471.     void *referID    - Reference ID as received in the interface function.
  1472.               This ID should *never* be used in any other way than
  1473.               to be sent to FPL. Don't think that the same
  1474.               variable will have the same ID twice or anything
  1475.               similar.
  1476.    RESULT
  1477.     Zero if ok, otherwise a standard FPL error code.
  1478.  
  1479.    EXAMPLE
  1480.     We added a function to FPL with a format string like "R" (one required
  1481.     variable reference to a string or an integer). To get the type and the
  1482.     name of the received variabl, we use the following code:
  1483.  
  1484.     char *name;
  1485.     long type;
  1486.     lonf *tags[]={
  1487.       FPLREF_TYPE, NULL,    /* get type */
  1488.       FPLREF_NAME, NULL,    /* get name */
  1489.       FPLREF_DONE
  1490.     };
  1491.     tags[1] = (long)&type;
  1492.     tags[3] = (long)&name;
  1493.     fplReference(key,        /* fplInit() return code */
  1494.              arg->argv[0],    /* refer ID!             */
  1495.              tags);
  1496.  
  1497.     if(type&FPLREF_TYPE_STRING)
  1498.       printf("The variable named '%s' is a string!\n", name);
  1499.     if(type&FPLREF_TYPE_INTEGER)
  1500.       printf("The variable named '%s' is an integer!\n", name);
  1501.  
  1502.  
  1503.    SEE ALSO
  1504.     <FPL/Reference.h>
  1505.